-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
: Split logic of ExerciseResource into endpoints per exercise-type
#9570
base: develop
Are you sure you want to change the base?
Conversation
*/ | ||
@GetMapping("exam/exercises/{exerciseId}") | ||
@EnforceAtLeastEditor | ||
public ResponseEntity<Exercise> getExamExercise(@PathVariable Long exerciseId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependency from exam->specific exercise should be fine for now, as one needs to know which exercises are created for an exam
|
||
// Exam exercise | ||
Exercise exercise = exerciseRepository.findByIdElseThrow(exerciseId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could reduce the repository call to just fetch the exercise type
return authCheckService.isAllowedToSeeExercise(exercise, user); | ||
} | ||
|
||
public boolean isCorrectExerciseType(Exercise exercise, Class<? extends Exercise> expectedExerciseClass) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be needed here, we don't gain a lot from sharing this method.
return expectedExerciseClass.isInstance(exercise); | ||
} | ||
|
||
public void setChannelName(Exercise exercise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to improve the naming here. For me, it's something similar to hydrateWithXY
or loadAndSetXY
to express that we are loading something from the DB.
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
This is a draft, feel free to ignore :)